package com.bfg.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@SuppressWarnings("serial")
public class TestServlet extends HttpServlet {

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String strParam = null;
		PrintWriter out = resp.getWriter();
		if (req.getParameter("txtname") != null) {
			strParam = req.getParameter("txtname");
		} else {
			strParam = "";
		}
		out.println("You have successfully made Ajax Call: " + strParam);
	}

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String strParam = req.getParameter("name");
		PrintWriter out = resp.getWriter();
		out.println("Hello, <b>" + strParam + "</b><br>");
		out.println("Test..Test..Servlet Up!!!");
	}
}
